package com.z6school.manage.controller;

import com.z6school.manage.common.pojo.JsonResult;
import com.z6school.manage.po.Menus;
import com.z6school.manage.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.awt.*;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/menu/")
public class MenuController {
    @Autowired
    private MenuService menuService;
    @RequestMapping("doFindObject")
    public JsonResult doFindObject(){
        return new JsonResult(menuService.doFindObject());
    }

    @RequestMapping("doDeleteObject")
    public JsonResult doDeleteObject(Integer id){
        menuService.doDeleteObject(id);
        return new JsonResult("delete ok");
    }

    @RequestMapping("doFindZtreeMenuNodes")
    public JsonResult doFindZtreeMenuNodes(){
        return new JsonResult(menuService.findZtreeMenuNodes());
    }

    @RequestMapping("doSaveObject")
    public JsonResult doSaveObject(Menus entity) {
        menuService.saveObject(entity);
        return new JsonResult("save ok");
    }
    @RequestMapping("doUpdateObject")
    public JsonResult doUpdateObject(Menus entity) {
        menuService.updateObject(entity);
        return new JsonResult("update ok");
    }



}
